const sequelize = require("./db");
const {
    DataTypes
} = require('sequelize');
const Blog = require("./Blog");
const Tag = require("./Tag");



// 标题，发布时间，摘要，具体内容，标签，背景地址
const BlogTags = sequelize.define('blogTag', {
    blogId: {
        type: DataTypes.STRING,
        allowNull: false,
    },
    tagId: {
        type: DataTypes.STRING,
        allowNull: false,
    }
}, {
    createdAt: false,
    updatedAt: false,
    paranoid: true,
});



Blog.belongsToMany(Tag, {
    through: BlogTags
})
Tag.belongsToMany(Blog, {
    through: BlogTags
})



module.exports = BlogTags;